package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.CrmHistoryLogModel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.sql.Timestamp;

/**
 * Created by lusong on 2017/6/8.
 */
public interface CrmHistoryLogRepository extends JpaRepository<CrmHistoryLogModel, Integer>, JpaSpecificationExecutor<CrmHistoryLogModel> {

    @Query("select max(a.nextConnectDate) from CrmHistoryLogModel a where a.historyId = ?1 and a.surveyResult = '2'")
    Timestamp queryNextConnectionDateByHistoryId(int historyId);
}
